package com.feiyi.app.adapter;

import android.media.Image;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.feiyi.app.R;
import com.feiyi.app.bean.GoodsSearchBean;
import com.feiyi.app.glideutils.GlideImgManager;
import com.feiyi.app.utils.ImageUtil;

import java.util.List;

/**
 * @author wangliantao
 * @time 2018 11 2018/11/18 5:43 AM
 * @email 1346947404@qq.com
 * @package com.feiyi.app.adapter
 * @describe： In me the tiger sniffs the rose
 */
public class MyFocusAdapter extends BaseQuickAdapter<GoodsSearchBean.DataBean,BaseViewHolder> {
    public MyFocusAdapter(int layoutResId, @Nullable List<GoodsSearchBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsSearchBean.DataBean item) {
        ImageView imageView = helper.getView(R.id.iv_item_focus);
        ImageUtil.suitDisplay(imageView,1,1,75,16);
        if (null != item.getImg() && !item.getImg().getThumb().isEmpty()){

            GlideImgManager.loadImage(mContext,item.getImg().getThumb(),imageView);
        }
        helper.setText(R.id.tv_focus_title,item.getName())
                .setText(R.id.tv_focus_price,item.getShop_price());
    }
}
